package state

import (
	"errors"
	"fmt"
)

type tClosedState struct {
	context iFileStreamContext
}


func newClosedState(context iFileStreamContext) iFileStreamState {
	return &tClosedState{
		context,
	}
}

func (me *tClosedState) OpenRead() error {
	return errors.New(fmt.Sprintf("tClosedState.OpenRead, file(%s) already closed ", me.context.File()))
}

func (me *tClosedState) OpenWrite() error {
	return errors.New(fmt.Sprintf("tClosedState.OpenWrite, file(%s) already closed ", me.context.File()))
}

func (me *tClosedState) Read(p []byte) (n int, e error) {
	return 0, errors.New(fmt.Sprintf("tClosedState.Read, file(%s) already closed ", me.context.File()))
}

func (me *tClosedState) Write(p []byte) (n int, e error) {
	return 0, errors.New(fmt.Sprintf("tClosedState.Write, file(%s) already closed ", me.context.File()))
}

func (me *tClosedState) Close() error {
	return nil
}